import request from '@/utils/request'

export const getOrders = (params) => {
  return request({
    url: '/orders/getorder',
    method: 'get',
    params
  })
}

export const getOrderByRoomId = (params) => {
  return request({
    url:'/orders/getOrderByRoomId',
    method:'get',
    params
  })
}

export const createOrder = (data) => {
  return request({
    url: '/orders/create',
    method: 'post',
    data
  })
}

export const cancelOrder = (id) => {
  return request({
    url: `/orders/${id}/cancel`,
    method: 'put'
  })
}

export const payOrder = (id) => {
  return request({
    url: `/orders/${id}/pay`,
    method: 'put'
  })
}

export const processRefund = (id, status) => {
  return request({
    url: `/orders/${id}/refund`,
    method: 'put',
    data: { status }
  })
}